<?php
error_reporting(0);
$isadmin=1;
include_once '../comm/config.php';
include '../comm/checkpostandget.php';
include 'check.php';

$ddusername=$_POST['ddusername']; $link = mysql_connect($dbserver, $dbuser, $dbpass);
if (!$link) {
     die(ERR_DB);
}
mysql_select_db($dbname);

mysql_query("set names utf8");

$sql="select Id from ".$BIAOTOU."user where ddusername='".$ddusername."'";
$query=mysql_query($sql);
$row=mysql_fetch_array($query);
$dduserid=$row['Id'];
$q = "delete from ".$BIAOTOU."tradelist where ddusername='$ddusername'";
mysql_query($q);
$q = "delete from ".$BIAOTOU."user where ddusername='$ddusername'";
mysql_query($q);
$q = "delete from ".$BIAOTOU."tixian where ddusername='$ddusername'";
mysql_query($q);
$q = "delete from ".$BIAOTOU."mingxi where ddusername='$ddusername'";
mysql_query($q);
$q = "delete from ".$BIAOTOU."tbjy where ddusername='$ddusername'";
mysql_query($q);
$q = "delete from ".$BIAOTOU."msg where ddusername='$ddusername'";
mysql_query($q);
$q = "update ".$BIAOTOU."user set tjr=NULL where tjr='$ddusername'";
mysql_query($q);
$q = "update ".$BIAOTOU."tradelist set username=NULL,qrsj=NULL where username='$ddusername'";
mysql_query($q);   

mysql_close($link);

if(UC==1){
    include '../data/config.inc.php';
	include '../uc_client/client.php';
	uc_user_delete($dduserid);	
	//echo uc_user_delete($ddusername);	
}


header('Location: userlist.php');  
?>
